import { Component, lazy } from 'solid-js'
import { HashRouter, RouteDefinition } from '@solidjs/router'
import { DefaultLayout } from './layouts/index'
import Home from '#pages/home'

const routes: RouteDefinition[] = [
  {
    path: '/',
    component: Home,
  },
  {
    path: 'about',
    component: () => <h1>About me</h1>,
  },
  {
    path: 'hello',
    component: lazy(() => import('#pages/hello')),
  },
  {
    path: '*404',
    component: lazy(() => import('#pages/errors/NotFound')),
  },
]

const App: Component = () => {
  return (
    <>
      <HashRouter root={DefaultLayout}>{routes}</HashRouter>
    </>
  )
}

export default App
